<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <div th:replace="authority/common/head"></div>
</head>
<body>

<!--<div th:include="header"></div>-->
<div class="zsa-center">
    <div class="layui-container fly-marginTop">
        <div class="fly-panel fly-panel-user" pad20>
            <div class="layui-tab layui-tab-brief" lay-filter="user">
                <ul class="layui-tab-title">
                    <li class="layui-this">登入</li>
                    <!--<li><a th:href="@{/user/to_reg.html}">注册</a></li>-->
                </ul>
                <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                    <div class="layui-tab-item layui-show">
                        <div class="layui-form layui-form-pane">
                            <!--/*@thymesVar id="loginUrl" type="java.lang.String"*/-->
                            <div id="container"></div>
                            <button id="btn" type="button"> 打开</button>

                            <div id="container1"></div>
                            <button id="btn1" type="button"> 打开</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <ul id="demoTree" class="dtree" data-id="0"></ul>
</div>

<div th:replace="authority/common/footer"></div>

<script>
    layui.extend({
        complexSearch: 'complexSearch/complexSearch' // {/}的意思即代表采用自有路径，即不跟随 base 路径
        // , dtree: 'dtree/dtree'
    })
    // layui.link(layui.cache.base + 'dtree/dtree.css?v=' + (layui.cache.version ? layui.cache.version : '1'));
    // layui.link(layui.cache.base + 'dtree/font/iconfont.css?v=' + (layui.cache.version ? layui.cache.version : '1'));
    layui.use(['lutil', 'form', 'complexSearch'/*, 'dtree'*/], function () {
        var form = layui.form, /*dtree = layui.dtree,*/ lutil = layui.lutil, complexSearch = layui.complexSearch;

        // var DemoTree = dtree.render({
        //     elem: "#demoTree",
        //     data: [{
        //         "id":"001",
        //         "title": "湖南省",
        //         "isLast": false,
        //         "level": "1",
        //         "parentId": "0",
        //         "children":[{
        //             "id":"001001",
        //             "title": "长沙市",
        //             "isLast":true,
        //             "parentId": "001",
        //             "level": "2"
        //         },{
        //             "id":"001002",
        //             "title": "株洲市",
        //             "isLast":true,
        //             "parentId": "001",
        //             "level": "2"
        //         },{
        //             "id":"001003",
        //             "title": "湘潭市",
        //             "isLast":true,
        //             "parentId": "001",
        //             "level": "2"
        //         },{
        //             "id":"001004",
        //             "title": "衡阳市",
        //             "isLast":true,
        //             "parentId": "001",
        //             "level": "2"
        //         },{
        //             "id":"001005",
        //             "title": "郴州市",
        //             "isLast":true,
        //             "parentId": "001",
        //             "level": "2"
        //         }]
        //     }],
        //     icon: "2",
        //     checkbar: true,
        //     dataStyle:"layuiStyle"
        // });
        // dtree.on("node('demoTree')" ,function(param){
        //     layer.msg(JSON.stringify(param));
        // });


        var a = complexSearch.render({
            container: "#container",
            btn: "#btn",
            search: function (data) {
                debugger;
            },
            isDynamic: false,
            returnFormat: {
                fieldName: 'field1'
            },
            data: [
                {
                    field: 'name',
                    title: '姓名',
                    editType: 'text',
                    dataType: 'string',
                    formulas: ['=', '>', 'range'],
                    formula: 'range'
                },
                {field: 'age', title: '年龄', editType: 'number', formulas: ['range']},
                // {field: 'time', title: '创建时间', editType: 'date',formula:'range'},
                {
                    field: 'sex',
                    title: '性别',
                    editType: 'select',
                    options: [{key: '男', value: '1'}, {key: '女', value: '0'}],
                    dataType: 'int', formulas: ['=','in', 'notin'], formula: 'range'
                }
            ]
        })
        a.setDefaultValues([{field: 'sex', formula: '=', value: [0,2]},{field: 'age', formula: 'range', value: '11~~18'}]);
        $('#btn').click(function () {
            a.reload();
        })
        var b = complexSearch.render({
            btn: "#btn1",
            search: function (data) {
                debugger;
            },
            width: 900,
            data: [
                {field: 'name', title: '姓名', editType: 'text', formulas: ['range']},
                {field: 'age', title: '年龄', editType: 'number'},
                {field: 'time', title: '创建时间', editType: 'date', dateType: 'year'},
                {
                    field: 'status',
                    title: '状态',
                    editType: 'select',
                    options: [{key: '有效', value: '1'}, {key: '无效', value: '0'}]
                },
                {
                    field: 'sex',
                    title: '性别',
                    editType: 'select',
                    options: [{key: '男', value: '1'}, {key: '女', value: '0'}]
                }
            ]
        })
    });

</script>

</body>
</html>